#ifndef TOUCH_CFG_H_
#define TOUCH_CFG_H_

//Power down mode controlparameter
//1:Enable, 0:Disable
#define g_SleepCtrl     (*((uint8_t volatile xdata*)0x30D))
#define TOUCHDEBUG (0)

extern unsigned char TOUCH_Auto_Set_Counter_Limit_Range(void);
extern unsigned char TOUCH_Reset_Limit_Range(void);

extern void TOUCH_IsrWDT(void);
extern void TOUCH_InitTouch(void);
extern void TOUCH_NormalRun();
extern void TOUCH_IsrTouch(void);

extern void IIC_IsrIIC0(void);
extern void IIC_InitIIC(unsigned char  Interface);
//According to practical application, user can change upper/lower limit by calliing this function
//0: AutoSet touch upper/lower limit data OK
//1: Online mode (Connecting with Touchlyzer)
//2: Number of programming is over the upper limit (Count>800)
//3: Error occurred
//uint8_t TOUCH_Auto_Set_Counter_Limit_Range(void)
//{
//    return TOUCH_Reset_Limit_Range();
//}

//========================================================================================================
//  Command Read Format:
//  Start    -> Slave(W) -> Ack -> Command -> Ack ->
//  Re-Start -> Slave(R) -> Ack ->   0x00  -> Ack ->  TKSTATUS1  -> Ack -> TKSTATUS0 -> NAck -> Stop
//
//  Touch Slave(W) Address = 0x60
//  Touch Slave(R) Address = 0x61
//  Read Key Status Command Number = 0x17
//
//  [Master Example]
//  Start    ->  0x60(W) -> Ack ->   0x17  -> Ack ->
//  Re-Start ->  0x61(R) -> Ack ->   0x00  -> Ack ->  TKSTATUS1  -> Ack -> TKSTATUS0 -> NAck -> Stop
//========================================================================================================

#endif // !TOUCH_CFG_H_

